import { isObject, extend } from './utils';
import { paramsList } from './params-list';
// @ts-ignore
import Swiper from 'swiper';
export const allowedParams = paramsList.map((key) => key.replace(/_/, ''));
export function getParams(obj = {}) {
    const params = {
        on: {},
    };
    // const events = {};
    const passedParams = {};
    extend(params, Swiper.defaults);
    extend(params, Swiper.extendedDefaults);
    params._emitClasses = true;
    params.init = false;
    const rest = {};
    const allowedParams = paramsList.map((key) => key.replace(/_/, ''));
    Object.keys(obj).forEach((key) => {
        const _key = key.replace(/^_/, '');
        if (allowedParams.indexOf(_key) >= 0) {
            if (isObject(obj[key])) {
                params[_key] = {};
                passedParams[_key] = {};
                extend(params[_key], obj[key]);
                extend(passedParams[_key], obj[key]);
            }
            else {
                params[_key] = obj[key];
                passedParams[_key] = obj[key];
            }
        }
        // else if (key.search(/on[A-Z]/) === 0 && typeof obj[key] === 'function') {
        //   events[`${_key[2].toLowerCase()}${key.substr(3)}`] = obj[key];
        // }
        else {
            rest[_key] = obj[key];
        }
    });
    ['navigation', 'pagination', 'scrollbar'].forEach((key) => {
        if (params[key] === true)
            params[key] = {};
        if (params[key] === false)
            delete params[key];
    });
    return { params, passedParams, rest };
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXBhcmFtcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9hbmd1bGFyL3NyYy91dGlscy9nZXQtcGFyYW1zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLE1BQU0sU0FBUyxDQUFDO0FBQzNDLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsYUFBYTtBQUNiLE9BQU8sTUFBTSxNQUFNLFFBQVEsQ0FBQztBQUU1QixNQUFNLENBQUMsTUFBTSxhQUFhLEdBQUcsVUFBVSx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